home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / nt / gd25s.zip / SYSTEM.H < prev    next >
C/C++ Source or Header  |  1993-10-08  |  5KB  |  238 lines

  1. /* System dependent declarations.
  2.    Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU DIFF.
  5.  
  6. GNU DIFF is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GNU DIFF is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU DIFF; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. /* We must define `volatile' and `const' first (the latter inside config.h),
  21.    so that they're used consistently in all system includes.  */
  22. #if !__STDC__
  23. #ifndef volatile
  24. #define volatile
  25. #endif
  26. #endif
  27. #include <config.h>
  28.  
  29. #include <sys/types.h>
  30. #include <sys/stat.h>
  31.  
  32. #if __STDC__ || defined(__MSDOS__) || defined(__NT__)
  33. #define PARAMS(args) args
  34. #define VOID void
  35. #else
  36. #define PARAMS(args) ()
  37. #define VOID char
  38. #endif
  39.  
  40. #if STAT_MACROS_BROKEN
  41. #undef S_ISBLK
  42. #undef S_ISCHR
  43. #undef S_ISDIR
  44. #undef S_ISFIFO
  45. #undef S_ISREG
  46. #undef S_ISSOCK
  47. #endif
  48. #ifndef S_ISDIR
  49. #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
  50. #endif
  51. #ifndef S_ISREG
  52. #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
  53. #endif
  54. #if !defined(S_ISBLK) && defined(S_IFBLK)
  55. #define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
  56. #endif
  57. #if !defined(S_ISCHR) && defined(S_IFCHR)
  58. #define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
  59. #endif
  60. #if !defined(S_ISFIFO) && defined(S_IFFIFO)
  61. #define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFFIFO)
  62. #endif
  63. #if !defined(S_ISSOCK) && defined(S_IFSOCK)
  64. #define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
  65. #endif
  66.  
  67. #ifndef S_IXOTH
  68. #define S_IXOTH 1
  69. #endif
  70. #ifndef S_IXGRP
  71. #define S_IXGRP (S_IXOTH << 3)
  72. #endif
  73. #ifndef S_IXUSR
  74. #define S_IXUSR (S_IXGRP << 3)
  75. #endif
  76.  
  77. #if HAVE_UNISTD_H
  78. #include <unistd.h>
  79. #endif
  80.  
  81. #ifndef SEEK_SET
  82. #define SEEK_SET 0
  83. #endif
  84. #ifndef SEEK_CUR
  85. #define SEEK_CUR 1
  86. #endif
  87.  
  88. #ifndef STDIN_FILENO
  89. #define STDIN_FILENO 0
  90. #endif
  91. #ifndef STDOUT_FILENO
  92. #define STDOUT_FILENO 1
  93. #endif
  94. #ifndef STDERR_FILENO
  95. #define STDERR_FILENO 2
  96. #endif
  97.  
  98. #if HAVE_TIME_H
  99. #include <time.h>
  100. #else
  101. #include <sys/time.h>
  102. #endif
  103.  
  104. #if HAVE_FCNTL_H
  105. #include <fcntl.h>
  106. #else
  107. #include <sys/file.h>
  108. #endif
  109.  
  110. #if !HAVE_DUP2
  111. #define dup2(f,t)    (close (t),  fcntl (f,F_DUPFD,t))
  112. #endif
  113.  
  114. #ifndef O_RDONLY
  115. #define O_RDONLY 0
  116. #endif
  117.  
  118. #if HAVE_SYS_WAIT_H
  119. #ifndef _POSIX_VERSION
  120. /* Prevent the NeXT prototype using union wait from causing problems.  */
  121. #define wait system_wait
  122. #endif
  123. #include <sys/wait.h>
  124. #ifndef _POSIX_VERSION
  125. #undef wait
  126. #endif
  127. #endif /* HAVE_SYS_WAIT_H */
  128.  
  129. #ifndef WEXITSTATUS
  130. #define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
  131. #undef WIFEXITED        /* Avoid 4.3BSD incompatibility with Posix.  */
  132. #endif
  133. #ifndef WIFEXITED
  134. #define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
  135. #endif
  136.  
  137. #if HAVE_ST_BLKSIZE
  138. #define STAT_BLOCKSIZE(s) (s).st_blksize
  139. #else
  140. #define STAT_BLOCKSIZE(s) (8 * 1024)
  141. #endif
  142.  
  143. #if DIRENT || defined (_POSIX_VERSION)
  144. #include <dirent.h>
  145. #else /* ! (DIRENT || defined (_POSIX_VERSION)) */
  146. #if SYSNDIR
  147. #include <sys/ndir.h>
  148. #else
  149. #if SYSDIR
  150. #include <sys/dir.h>
  151. #else
  152. #include <ndir.h>
  153. #endif
  154. #endif
  155. #ifdef dirent
  156. #undef dirent
  157. #endif
  158. #define dirent direct
  159. #endif /* ! (DIRENT || defined (_POSIX_VERSION)) */
  160.  
  161. #if HAVE_VFORK_H
  162. #include <vfork.h>
  163. #endif
  164.  
  165. #if HAVE_STDLIB_H
  166. #include <stdlib.h>
  167. #else
  168. VOID *malloc ();
  169. VOID *realloc ();
  170. #endif
  171. #ifndef getenv
  172. char *getenv ();
  173. #endif
  174.  
  175. #if HAVE_LIMITS_H
  176. #include <limits.h>
  177. #endif
  178. #ifndef INT_MAX
  179. #define INT_MAX 2147483647
  180. #endif
  181. #ifndef CHAR_BIT
  182. #define CHAR_BIT 8
  183. #endif
  184.  
  185. #if HAVE_STRING_H
  186. #include <string.h>
  187. #ifndef bzero
  188. #define bzero(s,n) memset (s,0,n)
  189. #endif
  190. #else /* !HAVE_STRING_H */
  191. #include <strings.h>
  192. #ifndef strchr
  193. #define strchr index
  194. #endif
  195. #ifndef strrchr
  196. #define strrchr rindex
  197. #endif
  198. #ifndef memcpy
  199. #define memcpy(d,s,n) bcopy (s,d,n)
  200. #endif
  201. #ifndef memcmp
  202. #define memcmp(s1,s2,n) bcmp (s1,s2,n)
  203. #endif
  204. #endif /* !HAVE_STRING_H */
  205. #if !HAVE_MEMCHR
  206. char *memchr ();
  207. #endif
  208.  
  209. #include <errno.h>
  210. #if !STDC_HEADERS
  211. extern int errno;
  212. #endif
  213.  
  214. #ifndef min
  215. #define min(a,b) ((a) <= (b) ? (a) : (b))
  216. #define max(a,b) ((a) >= (b) ? (a) : (b))
  217. #endif
  218.  
  219. #ifdef __MSDOS__
  220. typedef int pid_t;
  221. typedef long off_t;
  222. #include <stdio.h>
  223. #include <malloc.h>
  224. FILE *popen(char *, char *);
  225. int pclose(FILE *);
  226. #define HUGE huge
  227. #define FSIZE long
  228. #else
  229. #define HUGE
  230. #define FSIZE size_t
  231. #endif
  232.  
  233. #ifdef __NT__
  234. typedef int pid_t;
  235. #define popen    _popen
  236. #define pclose    _pclose
  237. #endif
  238.